package com.code.leetcode.offer;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;

/**
 * @author codeDorado
 * @version 1.0
 * @date 2020/8/3 10:43
 */
public class The50 {
    public char firstUniqChar(String s) {
        if (s == null || s.length() == 0) return ' ';
        Map<Character, Boolean> map = new HashMap<>();
        for (char c : s.toCharArray()) {
            map.put(c, !map.containsKey(c));
        }

        for (char c : s.toCharArray()) {
            if (map.get(c)) return c;
        }
        return ' ';
    }
}
